package com.qingfeng.provide.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.qingfeng.core.data.ResultData;
import com.qingfeng.core.entity.qingfeng.School;
import com.qingfeng.provide.service.SchoolService;

@RestController
@RequestMapping("/school")
public class SchoolController {
	@Autowired
	SchoolService schoolService;
	
	   @RequestMapping("/save")
	   public ResultData save(School school) {
		   ResultData resultData = new ResultData(ResultData.SUCCESS, "成功", null);
		   if(!schoolService.save(school)){
			   resultData = new ResultData(ResultData.FAIL, "失败，请联系管理员", null);
		   }
	       return resultData;
	   }
	   
	   @RequestMapping("/getSchoolList")
	   public ResultData getSchoolList(int areaId) {
		   ResultData resultData = new ResultData(ResultData.SUCCESS, "成功", schoolService.getSchoolList(areaId));
	       return resultData;
	   }
	   
	   
}
